package com.supporter.sysbench.util;

/**
 * @author xunaidong
 * @date 2021/8/8
 */
public abstract class RandomData {

    public static String cValue() {
        String Val = null;
        Val = String.format("%011d", Math.round(Math.random() * 100000000000D));
        for (int i = 0; i < 9; i++) {
            Val = Val + "-" + String.format("%011d", Math.round(Math.random() * 100000000000D));
        }
        return Val;
    }

    public static String padValue() {
        String Val = null;
        Val = String.format("%011d", Math.round(Math.random() * 100000000000D));
        for (int i = 0; i < 4; i++) {
            Val = Val + "-" + String.format("%011d", Math.round(Math.random() * 100000000000D));
        }
        return Val;
    }

    public static int getTableNum(int tableNumber,int threads) {
//        int currentTNo = Integer.valueOf(Thread.currentThread().getName().split("-")[1]);
//        if(tableNumber >= threads){
//            return  currentTNo;
//        }else {
//           return  threads/tableNumber+1;
//        }
        return (int) (Math.random() * (tableNumber)) + 1;
        //return Integer.valueOf(Thread.currentThread().getName().split("-")[1]);
    }

    public static int getId(int tableCount) {
        return (int) (Math.random() * (tableCount)) + 1;
    }

    public static int getKValue(int tableCount) {
        return (int) (Math.random() * (tableCount)) + 1;
    }

}
